home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / graphics / scan.lzh / SCAN.S < prev    next >
Text File  |  1991-02-21  |  3KB  |  91 lines

  1.          opt o+
  2.  
  3. start:        bra inst_scan            ;Jump to main routine
  4.         dc.b 'XBRA','SCAN'        ;Xbra identification
  5. old_vector:    ds.l 1
  6.  
  7. resident:    move.l old_vector(pc),a1    ;get old_vector adress
  8.         jsr (a1)            ;execute normal bconin
  9. get_shift:    btst #3,$000.W            ;get shift status
  10.         beq.s end_rout            ;No - Return from call
  11.         cmp.b #27,d0            ;ESC pressed
  12.         beq.s scan_image        ;Yes - Goto scan mode
  13. end_rout:    rts                ;No - Return from call
  14.  
  15. scan_image:    movem.l    d0-7/a0-6,-(sp)        ;Save regs
  16.         dc.w    $A00A            ;Hide Mouse
  17.         bsr.s    print_text        ;Copyright info
  18.         movea.l $44E.w,a0        ;Screen adress
  19.  
  20.         move.b    #8,d5            ;For btst of roller
  21.         move.b    #1,d3            ;For btst of data
  22.         move.w    #399,d7            ;400 lines/screen
  23.  
  24.         lea    $FB0000,a1        ;Status & Roller pos
  25.         lea    $FB1000,a2        ;Data request
  26.         lea    $FB2001,a3        ;Data receive
  27.  
  28.         move.b    #$13,$FFFFFC02.W    ;Shut off keyboard
  29.         move.w    #$2700,sr        ;Interrupts off
  30.         tst.w    $FB4000            ;Scanner light on
  31.         
  32. scan_line:    moveq    #79,d6            ;80 bytes/line
  33. wait_roller:    move.w    (a1),d2            ;Get roller status
  34.         btst.l    d5,d2            ;Has roller moved
  35.         bne.s    wait_roller        ;No, wait for move
  36. get_blank:    tst.w    (a2)            :Ask for data
  37. wait_blank:    btst.b    d3,(a1)            ;Data ready ?
  38.         beq.s    wait_blank        ;No, wait for blank
  39. get_data:    tst.w    (a2)            ;Ask for data
  40. wait_data:    btst.b    d3,(a1)            ;Data ready ?
  41.         beq.s    wait_data        ;No, wait for data
  42.         move.b    (a3),(a0)+        ;Move data to screen
  43.         dbf.w    d6,get_data        ;Ask for more data
  44.         dbf.w    d7,scan_line        ;Wait for next line
  45.         
  46. end_scan:    tst.w    $FB3000            ;Scanner light off
  47.         move.w    #$2300,sr        ;Interrupts on
  48.         move.b    #$11,$FFFFFC02.W    ;Keyboard on again
  49.         dc.w    $A009            ;Show Mouse
  50.         movem.l    (a7)+,d0-7/a0-6        ;Restore regs
  51.         move.l  #$390000,d0        ;Clear char/scan
  52.         rts                ;Return to program
  53.  
  54. print_text:    lea    tekst2(pc),a6        ;Info text
  55.         clr.w    d7
  56. next_char:    move.b    (a6)+,d7        ;End of text ?
  57.         beq.s    end_text        ;Yes, stop
  58.         move.w    d7,-(sp)        ;Char to print
  59.         move.l    #$030002,-(sp)        ;Bconout 2
  60.         trap    #13            ;Bios
  61.         addq.l    #6,sp
  62.         bra.s    next_char        ;Next char
  63. end_text:    rts
  64.  
  65. tekst2:        dc.b    27,'j',27,'H',27,'b'
  66. inv:        dc.b    '1',27,'c0'
  67.         dc.b    27,'J',10,'  GeniScan™ scanner interface',13,10,10
  68.         dc.b    '  ',$BD, ' Lars-Erik Østerud 02/1991'
  69.         dc.b    27,'b1',27,'c0',27,'k'
  70. tekst:        dc.b    27,'Y%   Press ALT-ESC to scan image',13,10,10,10,0
  71.  
  72. super_rout:    move.l    $4F2.W,A0        ;Get _sysbase
  73.         move.w    $26(A0),get_shift+4    ;Set kbshift adress
  74.         move.l    $53E+2*4.W,old_vector    ;Save old bconin(2) vector
  75.         move.l    #resident,$53E+2*4.W    ;Set new bconin(2) vector
  76.         rts
  77.                          
  78. inst_scan:    pea    super_rout(pc)        ;Things to do in supervisor
  79.         move.w    #38,-(sp)        ;Super
  80.         trap    #14            ;Xbios
  81.         addq.l    #6,sp 
  82.  
  83.         bsr    print_text        ;Print text
  84.         move.l    #$301B6331,inv        ;Set negative colors
  85.         clr.b    tekst            ;New end of text
  86.  
  87.         clr.w    -(sp)
  88.         move.l    #$101+tekst-start,-(sp)    ;Protect resident & tables
  89.         move.w    #$31,-(sp)
  90.         trap    #1
  91.